﻿@model DriveBabyDrive.Models.VehicleModel

@{
    ViewBag.Title = "UpdateVehicle";
}
<script type="text/javascript">
 
    function confirmDelete() {
        if (confirm('This will Delete all the readings associated with the vehicle. Are you sure?')) {
            window.location.href = "DeleteVehicle?vehicleId=+@Model.VehicleID";
        }
        else {
        }
    }
</script>
@section Header {
   
    <div class="ui-grid-b" style="padding:1%">
	    <div class="ui-block-a">@Html.ActionLink("Back", "Index/", "Home", null, new { data_icon = "arrow-l", data_rel = "back", data_role = "button" })</div>
	    <div class="ui-block-b"  style="text-align:center">@Html.ActionLink("Home", "Index/", "Home", null, new { data_icon = "home", data_iconpos = "notext", data_role = "button" })</div>
	   <div class="ui-block-c" style="text-align:right"> @Html.Partial("_LogOnPartial")</div>
    </div>
}

<h2>Update Vehicle Name:</h2>
@using (Html.BeginForm())
{
    @Html.ValidationSummary(true, "Vehicle Name could not be saved. Please correct the errors and try again.")

    <ul data-role="listview" data-inset="true">
        <li data-role="list-divider">Reading</li>

        <li data-role="fieldcontain">
            
            @Html.TextBoxFor(m => m.VehicleName, new { @type = "text", @placeholder = "Vehicle Name" })
            @Html.ValidationMessageFor(m => m.VehicleName)
        </li>
        <li data-role="fieldcontain">
                    <input type="submit" value="Save"  />
        </li>
        <li data-role="fieldcontain">
            <div>
                    <a id="hlnkDeleteVehicle" data-role="button" onclick="confirmDelete();">Delete</a>                    
                   
            </div>
        </li>

    </ul>
}